package org.iabako.shared.dto;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by jose on 13/11/14.
 */
public class FinancesChartData implements Serializable {

    private String title;
    private List<Double> values;

    //Transient
    private List<String> tooltips;
    private String tooltipPrefix;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public List<Double> getValues() {
        if (values == null) {
            values = new ArrayList<Double>();
        }
        return values;
    }

    public void addValue(Double value) {
        if (value == null) {
            value = 0D;
        }
        getValues().add(value);
    }

    public List<String> getTooltips() {
        if (tooltips == null) {
            tooltips = new ArrayList<String>();
        }
        return tooltips;
    }

    public void addTooltip(String tooltip) {
        if (tooltip == null) {
            tooltip = getValues().isEmpty() ? "" : getValues().get(getValues().size() - 1) + "";
        }
        getTooltips().add(tooltip);
    }

    public String getTooltipPrefix() {
        return tooltipPrefix;
    }

    public void setTooltipPrefix(String tooltipPrefix) {
        this.tooltipPrefix = tooltipPrefix;
    }
}
